package xiangmu.schoolpaper.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xiangmu.schoolpaper.mapper.LatestUploadMapper;
import xiangmu.schoolpaper.pojo.VO.*;
import xiangmu.schoolpaper.service.LatestUploadService;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Service
public class LatestUploadServiceImpl implements LatestUploadService {
    @Autowired
    private LatestUploadMapper latestUploadMapper;

    @Override
    public List<AllStudentPaperVO> getAllStudentPaper(Integer teacher) {
        List<AllStudentPaperVO> list = latestUploadMapper.getAllStudentPaper(teacher);
        return list;
    }

    @Override
    public List<AllStudentPaperVO> getAllStudentPaperTitle(Integer teacher,String paperTitle) {
        List<AllStudentPaperVO> list = latestUploadMapper.getAllStudentPaperTitle(teacher,paperTitle);
        return list;
    }

    @Override
    public List<GetStudentNameVO> getStudentInfo(Integer teacher) {
        return latestUploadMapper.getStudentInfo(teacher);
    }

    @Override
    public List<Integer> getGraduationYear(Integer teacher) {
        List<LocalDateTime> time= latestUploadMapper.getGraduationYear(teacher);
        List<Integer> list = new ArrayList<>();
        for (LocalDateTime l : time) {
            Integer year = l.getYear();
            list.add(year);
        }
        return list;
    }

    @Override
    public List<ExtractConentVO> getextractContent(Integer teacher) {
        return latestUploadMapper.getextractContent(teacher);
    }

    @Override
    public List<PaperScoreVO> getAllPaperScore(Integer teacher) {
        return latestUploadMapper.getAllPaperScore(teacher);
    }

    @Override
    public List<SomeStudentScoreVO> getByStudentId(Integer teacher, Integer studentId) {
        return latestUploadMapper.getByStudentId(teacher,studentId);
    }
}
